package com.tuo51.foudation.constant;

import lombok.Setter;


public class DefecationRecordConstant {
	
	public static final Integer DELETED = 0; 
  
    public enum DefecationType{
        BOWELS(0, "大便"),
        URINATE(1, "小便"),
        ;
    	
        @Setter
        private Integer code;

        @Setter
        private String value;

        DefecationType(int code, String value){
            this.code = code;
            this.value = value;
        }

        public int codeOf(){
            return code;
        }

        public String valueOf(){
            return value;
        }

        public DefecationType get(int code){
            for (DefecationType type : values()) {
                if (type.codeOf()==code)
                    return type;
            }
            return null;
        }

        public DefecationType getValueOf(String value){
            for (DefecationType type : values()) {
                if (value.contains(type.valueOf()))
                    return type;
            }
            return null;
        }
    }

    public enum DrugType{
        ALLERGY(3, "过敏"),
        ;
    	
        @Setter
        private Integer code;

        @Setter
        private String value;

        DrugType(int code, String value){
            this.code = code;
            this.value = value;
        }

        public int codeOf(){
            return code;
        }

        public String valueOf(){
            return value;
        }

        public DrugType get(int code){
            for (DrugType type : values()) {
                if (type.codeOf()==code)
                    return type;
            }
            return null;
        }

        public DrugType getValueOf(String value){
            for (DrugType type : values()) {
                if (value.contains(type.valueOf()))
                    return type;
            }
            return null;
        }
    }
    
    public enum HospitalType{
        OTHER(8, "其他原因"),
        ;
    	
        @Setter
        private Integer code;

        @Setter
        private String value;

        HospitalType(int code, String value){
            this.code = code;
            this.value = value;
        }

        public int codeOf(){
            return code;
        }

        public String valueOf(){
            return value;
        }

        public HospitalType get(int code){
            for (HospitalType type : values()) {
                if (type.codeOf()==code)
                    return type;
            }
            return null;
        }

        public HospitalType getValueOf(String value){
            for (HospitalType type : values()) {
                if (value.contains(type.valueOf()))
                    return type;
            }
            return null;
        }
    }
    
    public enum DietType{
        DIET(0, "餐饮"),
        
        ;
    	
        @Setter
        private Integer code;

        @Setter
        private String value;

        DietType(int code, String value){
            this.code = code;
            this.value = value;
        }

        public int codeOf(){
            return code;
        }

        public String valueOf(){
            return value;
        }

        public DietType get(int code){
            for (DietType type : values()) {
                if (type.codeOf()==code)
                    return type;
            }
            return null;
        }

        public DietType getValueOf(String value){
            for (DietType type : values()) {
                if (value.contains(type.valueOf()))
                    return type;
            }
            return null;
        }
    }
    
    public enum HandoverType{
        REL_OTHER(6, "其他关系"),
        
        ;
    	
        @Setter
        private Integer code;

        @Setter
        private String value;

        HandoverType(int code, String value){
            this.code = code;
            this.value = value;
        }

        public int codeOf(){
            return code;
        }

        public String valueOf(){
            return value;
        }

        public HandoverType get(int code){
            for (HandoverType type : values()) {
                if (type.codeOf()==code)
                    return type;
            }
            return null;
        }

        public HandoverType getValueOf(String value){
            for (HandoverType type : values()) {
                if (value.contains(type.valueOf()))
                    return type;
            }
            return null;
        }
    }
}
